//
//  YCHomeViewController.m
//  YCSchool
//
//  Created by yanglinxia on 16/4/26.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//  一乘驾校

#import "YCHomeViewController.h"
#import "YCNavigationViewController.h"
#import "YCHomeItemCell.h"
#import "YCHomeCellModel.h"
#import "YCHomeFooterViewButton.h"

/************ 学车导航 ********/
#import "YCProfileViewController.h"
#import "YCNewsViewController.h"
#import "YCActivitiesViewController.h"
#import "YCNotificationViewController.h"
#import "YCCarStyleDescViewController.h"
#import "YCClassStyleDescViewController.h"
#import "YCSignUpLocViewController.h"
#import "YCShopViewController.h"

/************ 学习状态 ********/
#import "YCTrainCarPlanViewController.h"
#import "YCExamBeforeViewController.h"
#import "YCInterviewDisplayViewController.h"
/************ 报名流程 ********/
#import "YCSelectCarStyleViewController.h"
/************ 教练身份 ********/
#import "YCRecruitViewController.h"
#import "YCTeachPlanViewController.h"

/************ 底部三个 ********/
#import "YCMeHomeViewController.h"
#import "YCSessionViewController.h"


@interface YCHomeViewController ()<UITableViewDelegate,UITableViewDataSource,YCHomeCellDelegate>

/** 表  */
@property (nonatomic, strong, readonly) UITableView *tableView;
/** headerView  */
@property (nonatomic, strong, readonly) UIView *headerView;
/** footerview  */
@property (nonatomic, strong, readonly) UIView *footerView;
/** 底部条  */
@property (nonatomic, strong, readonly) UIView *bottomView;
/** collectionView */
@property (nonatomic, strong) UICollectionView *collectionView;

/** 报名按钮  */
@property (nonatomic, strong) UIButton *applyBtn;
/** 练车计划按钮  */
@property (nonatomic, strong) YCHomeFooterViewButton *trainPlanBtn;
/** 考前学习按钮  */
@property (nonatomic, strong) YCHomeFooterViewButton *examBeforeBtn;
/** 预约考试按钮  */
@property (nonatomic, strong) YCHomeFooterViewButton *appointmentBtn;

/** 招募学员按钮  */
@property (nonatomic, strong) UIButton *recruitStuBtn;//YCHomeFooterViewButton *recruitStuBtn;
/** 教学计划按钮  */
@property (nonatomic, strong) UIButton *teachPlanBtn ;//YCHomeFooterViewButton *teachPlanBtn;
@property (nonatomic, strong) JSBadgeView *teachPlanBadgeView;

/** YCHomeItemCell(collectionView) */
@property(strong, nonatomic) YCHomeItemCell *collectionViewcell;

/** 数据  */
@property (nonatomic, strong) NSMutableArray *datas;

/** 头部图片  */
@property (nonatomic, weak) UIImageView *headImageView;
/** 头部文字  */
@property (nonatomic, weak) UILabel *titleLabel;


/** 判断是否登陆 */
@property (nonatomic, assign, getter=isLogin) BOOL login;
/** 判断是否是教练身份 */
@property (nonatomic, assign, getter=isCoach) BOOL coach;

/************* 数据源 ********/
/** cell中item数据源  */
@property (nonatomic, strong) NSMutableArray *items;

@end

@implementation YCHomeViewController

@synthesize tableView = _tableView;
@synthesize headerView = _headerView;
@synthesize footerView = _footerView;
@synthesize bottomView = _bottomView;


#pragma mark - 懒加载

- (NSMutableArray *)items
{
    if (!_items) {
        _items = [NSMutableArray array];
        
        YCHomeCellModel *model = [[YCHomeCellModel alloc] init];
        model.iconUrl = @"资讯";
        model.name = @"资讯";
        
        YCHomeCellModel *model1 = [[YCHomeCellModel alloc] init];
        model1.iconUrl = @"活动";
        model1.name = @"活动";
        
        YCHomeCellModel *model2 = [[YCHomeCellModel alloc] init];
        model2.iconUrl = @"通知";
        model2.name = @"通知";
        model2.badgeNumber = 3;
        
        YCHomeCellModel *model3 = [[YCHomeCellModel alloc] init];
        model3.iconUrl = @"车型";
        model3.name = @"车型";
        
        YCHomeCellModel *model4 = [[YCHomeCellModel alloc] init];
        model4.iconUrl = @"班型";
        model4.name = @"班型";
        
        YCHomeCellModel *model5 = [[YCHomeCellModel alloc] init];
        model5.iconUrl = @"报名点";
        model5.name = @"报名点";
        
        YCHomeCellModel *model6 = [[YCHomeCellModel alloc] init];
        model6.iconUrl = @"商城";
        model6.name = @"商城";
        
        //        YCHomeCellModel *model7 = [[YCHomeCellModel alloc] init];
        //        model7.iconUrl = @"自助练车";
        //        model7.name = @"自助练车";
        
        [_items addObjectsFromArray:@[model,model1,model2,model3,model4,model5,model6]];
        
        if ((_items.count % 3 )!=0) {
            NSInteger x = _items.count % 3;
            x = 3-x;
            for (NSInteger i = 0; i<x; i++) {
                YCHomeCellModel *model = [[YCHomeCellModel alloc] init];
                model.iconUrl = @"空";
                model.name = @"";
                [_items addObject:model];
            }
        }
    }
    return _items;
}

- (UITableView *)tableView
{
    if(!_tableView)
    {
        CGRect rect = CGRectMake(0, 64, self.view.yc_width, self.view.yc_height - 100);
        _tableView = [[UITableView alloc] initWithFrame:rect style:UITableViewStylePlain];
        _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.scrollEnabled = YES;
    }
    return _tableView;
}

// headView
- (UIView *)headerView
{
    if (!_headerView) {
        __block CGFloat height = 0;
        [YCAdapter performOtherBlock:^{
            height = 100;
        } IPhone6Block:^{
            height = 150;
        } IPhone6pBlock:^{
            height = 160;
        }];
        _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
        //图片
        UIImageView *imageView = [[UIImageView alloc] init];
        [_headerView addSubview:imageView];
        [imageView yc_setWebImageWithURLString:@"http://s15.sinaimg.cn/middle/5fbfbd0ct77462ee1039e&690" holderSize:CGSizeMake(kScreenWidth, height)];
        imageView.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headImageTapEvent:)];
        [imageView addGestureRecognizer:tap];
        self.headImageView = imageView;
        //文字
        UILabel *label = [[UILabel alloc] init];
        label.textAlignment = NSTextAlignmentLeft;
        label.textColor = [UIColor whiteColor];
        label.font = [UIFont systemFontOfSize:15];
        label.text = @"走进一乘 魅力一乘";
        [_headerView addSubview:label];
        self.titleLabel = label;
        
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.right.top.equalTo(_headerView);
        }];
        
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_headerView).offset(20);
            make.bottom.equalTo(_headerView).offset(-18);
        }];
    }
    return _headerView;
}


// footerView
- (UIView *)footerView
{
    if(!_footerView)
    {
        __block CGFloat height = 0;
        [YCAdapter performOtherBlock:^{
            height = 100;
        } IPhone6Block:^{
            height = 149;//298/2
        } IPhone6pBlock:^{
            height = 160;
        }];
        _footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
        
        //练车计划
        YCHomeFooterViewButton *trainPlanBtn = [[YCHomeFooterViewButton alloc] init];
        [trainPlanBtn setTitle:@"练车计划" forState:UIControlStateNormal];
        [trainPlanBtn sizeToFit];
        self.trainPlanBtn = trainPlanBtn;
        
        //考前学习
        YCHomeFooterViewButton *examBeforeBtn = [[YCHomeFooterViewButton alloc] init];
        [examBeforeBtn setTitle:@"考前学习" forState:UIControlStateNormal];
        self.examBeforeBtn = examBeforeBtn;
        
        //预约考试
        YCHomeFooterViewButton *appointmentBtn = [[YCHomeFooterViewButton alloc] init];
        [appointmentBtn setTitle:@"预约考试" forState:UIControlStateNormal];
        self.appointmentBtn = appointmentBtn;
        
        
        //报名
        UIButton *applyBtn = [[UIButton alloc] init];
        [applyBtn setTitle:@"报名" forState:UIControlStateNormal];
        applyBtn.backgroundColor = [UIColor yc_colorWithUInt:0x5dc811];
        __block CGFloat widthHeight = 0;
        [YCAdapter performOtherBlock:^{
            widthHeight = 120;
        } IPhone6Block:^{
            widthHeight = 175;
        } IPhone6pBlock:^{
            widthHeight = 175;
        }];
        applyBtn.layer.cornerRadius = widthHeight / 4.0;
        applyBtn.layer.masksToBounds = YES;
        self.applyBtn = applyBtn;
        
        // 招募学员
//        YCHomeFooterViewButton *recruitStuBtn = [[YCHomeFooterViewButton alloc] init];
//        [recruitStuBtn setTitle:@"招募学员" forState:UIControlStateNormal];
//        self.recruitStuBtn = recruitStuBtn;
        UIButton *recruitStuBtn = [[UIButton alloc] init];
        [recruitStuBtn setImage:[UIImage imageNamed:@"招募"] forState:UIControlStateNormal];
        [recruitStuBtn setTitle:@"招募学员" forState:UIControlStateNormal];
        recruitStuBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
        recruitStuBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        recruitStuBtn.layer.cornerRadius = 15;
        recruitStuBtn.layer.masksToBounds = YES;
        recruitStuBtn.backgroundColor = [UIColor yc_colorWithUInt:0x262626];
        self.recruitStuBtn = recruitStuBtn;
        
        // 教学计划
//        YCHomeFooterViewButton *teachPlanBtn = [[YCHomeFooterViewButton alloc] init];
//        [teachPlanBtn setTitle:@"教学计划" forState:UIControlStateNormal];
//        self.teachPlanBtn = teachPlanBtn;
//        JSBadgeView *teachPlanBadgeView = [[JSBadgeView alloc] initWithParentView:teachPlanBtn alignment:JSBadgeViewAlignmentTopRight];
//        teachPlanBadgeView.badgeText = @" 新任务 ";
//        teachPlanBadgeView.badgePositionAdjustment = CGPointMake(-25,5);
//        teachPlanBadgeView.badgeTextFont = [UIFont systemFontOfSize:13];
//        self.teachPlanBadgeView = teachPlanBadgeView;
//        teachPlanBtn.clipsToBounds = NO;
        UIButton *teachPlanBtn = [[UIButton alloc] init];
        [teachPlanBtn setImage:[UIImage imageNamed:@"教学计划icon"] forState:UIControlStateNormal];
        [teachPlanBtn setTitle:@"教学计划" forState:UIControlStateNormal];
        teachPlanBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
        teachPlanBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        teachPlanBtn.layer.cornerRadius = 15;
        teachPlanBtn.layer.masksToBounds = YES;
        teachPlanBtn.backgroundColor = [UIColor yc_colorWithUInt:0x262626];
        self.teachPlanBtn = teachPlanBtn;
        
        UIView *redView = [[UIView alloc] init];
        redView.layer.cornerRadius = 5;
        redView.layer.masksToBounds = YES;
        redView.backgroundColor = [UIColor redColor];
        // 还要加一个引用引用这个redview,隐藏
        [teachPlanBtn addSubview:redView];
        teachPlanBtn.clipsToBounds = NO;
        [redView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.equalTo(@10);
            make.centerY.equalTo(teachPlanBtn.mas_top).offset(3);
            make.right.equalTo(teachPlanBtn).offset(-1);
        }];
        
        // 分隔线
        UIView *line = [[UIView alloc] init];
        line.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.3];
        
        [_footerView addSubview:trainPlanBtn];
        [_footerView addSubview:examBeforeBtn];
        [_footerView addSubview:appointmentBtn];
        [_footerView addSubview:applyBtn];
        [_footerView addSubview:recruitStuBtn];
        [_footerView addSubview:teachPlanBtn];
        [_footerView addSubview:line];
        
        [trainPlanBtn addTarget:self action:@selector(didTouchUpInsidetrainPlanButton:) forControlEvents:UIControlEventTouchUpInside];//练车计划
        [examBeforeBtn addTarget:self action:@selector(didTouchUpInsideExamBeforeButton:) forControlEvents:UIControlEventTouchUpInside];//考前学习
        [appointmentBtn addTarget:self action:@selector(didTouchUpInsideAppointmentButton:) forControlEvents:UIControlEventTouchUpInside];//预约考试
        [applyBtn addTarget:self action:@selector(didTouchUpInsideApplyButton:) forControlEvents:UIControlEventTouchUpInside];//报名
        [recruitStuBtn addTarget:self action:@selector(didTouchUpInsideRecruitStuButton:) forControlEvents:UIControlEventTouchUpInside];//招募学员
        [teachPlanBtn addTarget:self action:@selector(didTouchUpInsideTeachPlanButton:) forControlEvents:UIControlEventTouchUpInside];//教学考试
        
        // 布局子控件
        CGFloat width = _footerView.yc_width / 3.0;
        
        [examBeforeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.and.centerY.equalTo(_footerView);
            make.width.and.height.equalTo(@(widthHeight/2.0));
        }];
        
        [trainPlanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(examBeforeBtn.mas_centerX).offset(-width);
            make.centerY.equalTo(_footerView);
            make.width.and.height.equalTo(@(widthHeight/2.0));
        }];
        
        [appointmentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(examBeforeBtn.mas_centerX).offset(width);
            make.centerY.equalTo(_footerView);
            make.width.and.height.equalTo(@(widthHeight/2.0));
        }];
        
        [applyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(examBeforeBtn);
        }];
        
        [recruitStuBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_footerView).offset(35);
            make.centerY.equalTo(_footerView);
            make.width.equalTo(teachPlanBtn);
            make.height.equalTo(@30);
        }];
        
        [teachPlanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(recruitStuBtn.mas_right).offset(30);
            make.right.equalTo(_footerView).offset(-35);
            make.centerY.equalTo(_footerView);
            make.width.and.height.equalTo(recruitStuBtn);
        }];
        
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.equalTo(_footerView);
            make.height.equalTo(@1);
        }];
        
    }
    return _footerView;
}

// 底部条
- (UIView *)bottomView
{
    if (!_bottomView) {
        _bottomView = [[UIView alloc] init];
        
        UIButton *button1 = [[UIButton alloc] init];
        [button1 setImage:[UIImage imageNamed:@"一乘未选中"] forState:UIControlStateNormal];
        [button1 setImage:[UIImage imageNamed:@"一乘"] forState:UIControlStateSelected];
        button1.selected = YES;//默认选中
        button1.imageView.contentMode = UIViewContentModeCenter;
        
        
        UIButton *button2 = [[UIButton alloc] init];
        [button2 setImage:[UIImage imageNamed:@"聊天"] forState:UIControlStateNormal];
        [button2 setImage:[UIImage imageNamed:@"聊天选中"] forState:UIControlStateSelected];
        button2.imageView.contentMode = UIViewContentModeCenter;
        
        UIButton *button3 = [[UIButton alloc] init];
        [button3 setImage:[UIImage imageNamed:@"我"] forState:UIControlStateNormal];
        button3.imageView.contentMode = UIViewContentModeCenter;
        
        // 分隔线
        UIView *line = [[UIView alloc] init];
        line.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.3];
        
        [_bottomView addSubview:button1];
        [_bottomView addSubview:button2];
        [_bottomView addSubview:button3];
        [_bottomView addSubview:line];
        
        [button1 addTarget:self action:@selector(didTouchUpInsideLeftButton:) forControlEvents:UIControlEventTouchUpInside];
        [button2 addTarget:self action:@selector(didTouchUpInsideMiddleButton:) forControlEvents:UIControlEventTouchUpInside];
        [button3 addTarget:self action:@selector(didTouchUpInsideRightButton:) forControlEvents:UIControlEventTouchUpInside];
        
        [button1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_bottomView.mas_left).offset(20);
            make.centerY.equalTo(_bottomView);
            make.width.and.height.equalTo(@50);
        }];
        
        [button2 mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.centerX.and.centerY.equalTo(_bottomView);
            make.width.and.height.equalTo(@50);
        }];
        
        [button3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(_bottomView.mas_right).offset(-20);
            make.centerY.equalTo(_bottomView);
            make.width.and.height.equalTo(@50);
        }];
        
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.equalTo(_bottomView);
            make.height.equalTo(@1);
        }];
    }
    return _bottomView;
}

- (void)setLogin:(BOOL)login
{
    _login = login;
    NSArray *items = self.navigationItem.rightBarButtonItems;
    UIBarButtonItem *rightItem = items[items.count -1];
    //    UIBarButtonItem *rightItem = self.navigationItem.rightBarButtonItems.lastObject;
    rightItem.title = self.isLogin ? @"已报名" : @"未报名";
    
    self.examBeforeBtn.hidden = !self.isLogin;
    self.appointmentBtn.hidden = !self.isLogin;
    self.trainPlanBtn.hidden = !self.isLogin;
    self.applyBtn.hidden = self.isLogin;
    
    self.coach = NO;
    
}

- (void)setCoach:(BOOL)coach
{
    _coach = coach;
    NSArray *items = self.navigationItem.leftBarButtonItems;
    UIBarButtonItem *leftItem = items[items.count -1];
    leftItem.title = self.isCoach ? @"教练" : @"学员";
    
    if (self.isCoach) {
        self.examBeforeBtn.hidden = self.isCoach;
        self.appointmentBtn.hidden = self.isCoach;
        self.trainPlanBtn.hidden = self.isCoach;
        self.applyBtn.hidden = self.isCoach;
    } else {
        self.examBeforeBtn.hidden = !self.isLogin;
        self.appointmentBtn.hidden = !self.isLogin;
        self.trainPlanBtn.hidden = !self.isLogin;
        self.applyBtn.hidden = self.isLogin;
    }
    
    self.recruitStuBtn.hidden = !self.isCoach;
    self.teachPlanBtn.hidden = !self.isCoach;
    
}

#pragma mark - 生命周期方法

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"一乘驾校";
    [self makeView];
    self.headerView.backgroundColor = [UIColor whiteColor];
    
    // 临时
    self.coach = NO;//默认为学员
    [self yc_addLeftBarButtonItemWithTitle:@"学员" target:self action:@selector(didTouchUpInsideNavigationBarLeftButton:)];
    // 临时
    self.login = NO;//开始为未报名
    [self yc_addRightBarButtonItemWithTitle:@"未报名" target:self action:@selector(didTouchUpInsideNavigationBarRightButton:)];
    
}

- (void)makeView
{
    [self.view addSubview:self.tableView];
    [self.view addSubview:self.bottomView];
    self.tableView.tableHeaderView = self.headerView;
    self.tableView.tableFooterView = self.footerView;
    
    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(self.view);
        make.height.equalTo(@50);
    }];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        make.bottom.equalTo(self.bottomView.mas_top);
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - UITableView dataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YCHomeItemCell *cell = [YCHomeItemCell tableViewCellWithTableView:tableView withIndexPath:indexPath];
    cell.cellDelegate = self;
    self.collectionViewcell = cell;
    return cell;
}

#pragma mark - UITableView delegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YCHomeItemCell *cell = self.collectionViewcell;
    cell.items = self.items;
    return [cell updateWithModels:self.items];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma mark - YCHomeCellDelegate
- (void)homeItemCell:(UICollectionView *)itemCollectionCell didSelectItemAtIndexPath:(NSIndexPath *)indexPatch
{
    switch (indexPatch.item) {
        case 0: // 资讯
        {
            YCNewsViewController *newsVc = [[YCNewsViewController alloc] init];
            [self.navigationController pushViewController:newsVc animated:YES];
        }
            break;
            
        case 1: // 活动
        {
            YCActivitiesViewController *activitiesVc = [[YCActivitiesViewController alloc] init];
            [self.navigationController pushViewController:activitiesVc animated:YES];
        }
            break;
            
        case 2: // 通知
        {
            YCNotificationViewController *notiVc = [[YCNotificationViewController alloc] init];
            //            [self presentViewController:notiVc animated:YES completion:nil];
            [self.navigationController pushViewController:notiVc animated:YES];
        }
            break;
            
        case 3: // 车型
        {
            YCCarStyleDescViewController *carStyleDescVc = [[YCCarStyleDescViewController alloc] init];
            [self.navigationController pushViewController:carStyleDescVc animated:YES];
        }
            break;
            
        case 4: // 班型
        {
            YCClassStyleDescViewController *classStyleDescVc = [[YCClassStyleDescViewController alloc] init];
            [self.navigationController pushViewController:classStyleDescVc animated:YES];
        }
            break;
            
        case 5:// 报名点
        {
            YCSignUpLocViewController *signUpLocVc = [[YCSignUpLocViewController alloc] init];
            [self.navigationController pushViewController:signUpLocVc animated:YES];
        }
            break;
            
        case 6: // 商城
        {
            YCShopViewController *shopVc = [[YCShopViewController alloc] init];
            [self.navigationController pushViewController:shopVc animated:YES];
        }
            break;
            
        case 7:// 自助练车
        {
            YCLog(@"自助练车---");
        }
            break;
            
        default:
            break;
    }
}

#pragma mark - 点击事件监听

- (void)didTouchUpInsideNavigationBarRightButton:(UIBarButtonItem *)barButtonItem
{
    YCLogFunc
    self.login = !self.isLogin;
}

- (void)didTouchUpInsideNavigationBarLeftButton:(UIBarButtonItem *)barButtonItem
{
    YCLogFunc
    self.coach = !self.isCoach;
}

// 驾校简介
- (void)headImageTapEvent:(UITapGestureRecognizer *)tapGesture
{
    YCProfileViewController *trainCarVc = [[YCProfileViewController alloc] init];
    [self.navigationController pushViewController:trainCarVc animated:YES];
}


// 底部条按钮点击事件
- (void)didTouchUpInsideLeftButton:(UIButton *)button
{
    YCLogFunc
    
}

// 聊天
- (void)didTouchUpInsideMiddleButton:(UIButton *)button
{
    YCLogFunc
    YCSessionViewController *rootVc = [[YCSessionViewController alloc] init];
    YCNavigationViewController *nav = [[YCNavigationViewController alloc] initWithRootViewController:rootVc];
    [UIApplication sharedApplication].keyWindow.rootViewController = nav;
    
}

//个人页
- (void)didTouchUpInsideRightButton:(UIButton *)button
{
    UIViewController *rootVc = [[YCMeHomeViewController alloc] init];
    YCNavigationViewController *nav = [[YCNavigationViewController alloc] initWithRootViewController:rootVc];
    [UIApplication sharedApplication].keyWindow.rootViewController = nav;
}

// footerView中按钮点击事件
/// 练车计划
- (void)didTouchUpInsidetrainPlanButton:(UIButton *)button
{
    YCTrainCarPlanViewController *trainCarVc = [[YCTrainCarPlanViewController alloc] init];
    [self.navigationController pushViewController:trainCarVc animated:YES];
    
}

/// 考前学习
- (void)didTouchUpInsideExamBeforeButton:(UIButton *)button
{
    YCExamBeforeViewController *examBeforeVc = [[YCExamBeforeViewController alloc] init];
    [self.navigationController pushViewController:examBeforeVc animated:YES];
}

/// 预约考试
- (void)didTouchUpInsideAppointmentButton:(UIButton *)button
{
    YCInterviewDisplayViewController *interviewVc = [[YCInterviewDisplayViewController alloc] init];
    [self.navigationController pushViewController:interviewVc animated:YES];;
    
}
/// 报名
- (void)didTouchUpInsideApplyButton:(UIButton *)button
{
    YCLogFunc;
    YCSelectCarStyleViewController *selectCarVc = [[YCSelectCarStyleViewController alloc] init];
    [self.navigationController pushViewController:selectCarVc animated:YES];
}

/// 招募学员
- (void)didTouchUpInsideRecruitStuButton:(UIButton *)button
{
    YCLogFunc;
    YCRecruitViewController *vc = [[YCRecruitViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

/// 教学计划
- (void)didTouchUpInsideTeachPlanButton:(UIButton *)button
{
    YCLogFunc;
    YCTeachPlanViewController *vc = [[YCTeachPlanViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}




@end
